@echo off
rem ====	MakeOfficeActivateShortcut.bat 2024-11-03
::	EndCmd

if "%~1"=="" (
	set "EndCmd=k"
) else (
	set "EndCmd=c"
)

call :Office2019Activate

goto End

:Office2019Activate
	rem ====	Microsoft Office Activate.zip
	set "Shortcut=%HOMEDRIVE%\PortableApps\Shortcut\Shortcut.exe"
	if /i exist "%SystemDrive%\Program Files\Microsoft Office\root\Office16\1028\MSAIN.DLL" (
		call :Checkdir %PUBLIC%\desktop\OfficeProPlus2019\
		%Shortcut%  /T:"%HOMEDRIVE%\PortableApps\Microsoft Office Activate\Activate Office 2019.cmd"  /F:"%PUBLIC%\desktop\OfficeProPlus2019\Activate Office 2019.cmd.lnk"  /I:"%HOMEDRIVE%\Program Files\Microsoft Office\root\Office16\1028\MSAIN.DLL"  /A:c
		%Shortcut%  /T:"%HOMEDRIVE%\PortableApps\Microsoft Office Activate\Detect office activation status.cmd"  /F:"%PUBLIC%\desktop\OfficeProPlus2019\Detect office activation status.cmd.lnk"  /I:"%HOMEDRIVE%\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\OFFICE16\MSO.DLL"  /A:c
	)
	exit /b

:Checkdir
	rem ====----	https://stackoverflow.com/questions/18639663/how-to-pass-command-line-parameters-with-space-in-batch-file

	if exist "%*" (
		exit /b
	)
	if not exist "%*" (
		mkdir "%*"
	)
	if exist "%*" (
		echo %* Created
	)
	exit /b

:End
	%ComSpec% /%EndCmd%